
public class Student {
    private String name;
    private int age;
    private Group group;
    public Student(String name, int age, Group group) {
        this.name = name;
        this.age = age;
        this.group = group;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
    public Group getGroup() {
        return group;
    }
    public void setGroup(Group group) {
        this.group = group;
    }
    @Override
    public String toString() {
        return "学生{" +
                "姓名='" + name + '\'' +
                ", 年龄=" + age +
                ", 小组=" + (group != null ? group.getName() : "未分配") +
                '}';
    }
}
